<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <!-- 思想，通过克隆一个对象，来产生另一个一模一样的对象。原型模式的意义不大 -->
    <script>
        var Plane = function () {
            this.blood = 100;
            this.attackLevel = 1;
            this.defenseLevel = 1;
        };
        var plane = new Plane();
        plane.blood = 500;
        plane.attackLevel = 10;
        plane.defenseLevel = 7;
        var clonePlane = Object.create(plane);
        console.log(clonePlane); // 输出：Object {blood: 500, attackLevel: 10, defenseLevel: 7}
        console.log(clonePlane.__proto__); // 输出：Object {blood: 500, attackLevel: 10, defenseLevel: 7}
        // 在不支持 Object.create 方法的浏览器中，则可以使用以下代码：
        // Object.create = Object.create || function (obj) {
        //     var F = function () { };
        //     F.prototype = obj;
        //     return new F();
        // }
    </script>
</body>

</html>